<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>文档列表 - 光年(Light Year Admin V5)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/style.min.css">

<link rel="stylesheet" type="text/css" href="__STATIC__/common/cch.css">
<style>  
  #tablednd tr:hover {  
      background-color: #f5f5f5;  
  }  
</style>  
</head>
  
<body>
<div class="container-fluid">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          <form action="" method="post">
            <input type="hidden" name="wx_activity_id" value="{:$wx_activity_id}" />
          <div class="card-btns mb-2-5">
            <a class="btn btn-success me-1" href="javascript:void(0)" onclick="cloneParams()"><i class="mdi mdi-plus"></i> 新增</a>
            <button class="btn btn-info" type="submit"><i class="mdi mdi-content-save"></i> 保存</button>
            <a class="btn btn-default" href="javascript:history.back(-1);"><i class="mdi mdi-keyboard-backspace"></i> 返回</a>
            <!-- <a class="btn btn-danger more_delete_btn" href="#!" data-url='{:url("moreDelete",[],"")}'><i class="mdi mdi-window-close"></i> 删除</a> -->
          </div>
          <div class="table-responsive">
            <table class="table table-bordered" id="tablednd">
              <thead>
                <tr>
                  <th>字段名称</th>
                  <th>显示</th>
                  <th>必填</th>
                  <th>只读</th>
                  <th>字段类型</th>
                  <th>字段参数（多个选项间用 , 分割）</th>
                  <th>默认值</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                  <?php foreach ($list as $k => $vo): ?>
                    <tr>
                      <td><input type="text" class="form-control" name="name[]" value="{:$vo['name']}" /></td>
                      <td><select class="form-select" name="is_show[]">
                        <option value="1" {:$vo['is_show'] == 1?'selected':''}>是</option>
                        <option value="0">否</option>
                      </select></td>
                      <td><select class="form-select" name="is_must[]">
                        <option value="0">否</option>
                        <option value="1" {:$vo['is_must'] == 1?'selected':''}>是</option>
                      </select></td>
                      <td><select class="form-select" name="is_readonly[]">
                        <option value="0">否</option>
                        <option value="1" {:$vo['is_readonly'] == 1?'selected':''}>是</option>
                      </select></td>
                      <td><select class="form-select" name="type[]">
                        <?php foreach ($types as $param_k => $param_v): ?>
                            <option value="{:$param_k}" {:$param_k==$vo['type']?'selected':''}>{:$param_v}</option>
                        <?php endforeach ?>
                      </select></td>
                      <td><input type="text" class="form-control" name="params[]" value="{:$vo['params']}" /></td>
                      <td><input type="text" class="form-control" name="default[]" value="{:$vo['default']}" /></td>
                      <td>
                        <div class="btn-group btn-group-sm">
                          <a class="btn btn-default" href="javascript:void(0)" onclick="deleteParams(this)" data-bs-toggle="tooltip" title="删除"><i class="mdi mdi-delete"></i></a>
                        </div>
                      </td>
                    </tr>
                  <?php endforeach ?>
              </tbody>
            </table>
          </div>

          </form>
          
        </div>
      </div>
    </div>
        
  </div>
  
</div>

<table class="my_clone" style="display: none;">
  <tr>
    <td><input type="text" class="form-control" name="name[]" /></td>
    <td><select class="form-select" name="is_show[]">
      <option value="1">是</option>
      <option value="0">否</option>
    </select></td>
    <td><select class="form-select" name="is_must[]">
      <option value="0">否</option>
      <option value="1">是</option>
    </select></td>
    <td><select class="form-select" name="is_readonly[]">
      <option value="0">否</option>
      <option value="1">是</option>
    </select></td>
    <td><select class="form-select" name="type[]">
      <?php foreach ($types as $param_k => $param_v): ?>
          <option value="{:$param_k}">{:$param_v}</option>
      <?php endforeach ?>
    </select></td>
    <td><input type="text" class="form-control" name="params[]" /></td>
    <td><input type="text" class="form-control" name="default[]" /></td>
    <td>
      <div class="btn-group btn-group-sm">
        <a class="btn btn-default" href="javascript:void(0)" onclick="deleteParams(this)" data-bs-toggle="tooltip" title="删除"><i class="mdi mdi-delete"></i></a>
      </div>
    </td>
  </tr>
</table>



<script type="text/javascript" src="__STATIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/popper.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/main.min.js"></script>

<script type="text/javascript" src="__STATIC__/common/tablednd/jquery.tablednd_0_5.js"></script>
<!--自定义扩展-->
<script type="text/javascript" src="__STATIC__/common/cch.js"></script>
</body>
 <script type="text/javascript">  
    function cloneParams(){
        var my_clone = $('.my_clone').find('tr')[0];
        var temp = $(my_clone).clone(true);
        var result = $("#tablednd").append(temp);

        $("#tablednd").tableDnD({
          onDragClass:'highlight'
        });  
    }

    function deleteParams(obj){
        $(obj).parent().parent().parent().remove();
    }

    $(document).ready(function() {  
        $("#tablednd").tableDnD({
          onDragClass:'highlight'
        });  
    });  
  </script> 
</html>